using FlowCanvas;
using FlowCanvas.Nodes;
using ParadoxNotion.Design;
using UnityEngine;

namespace Yoozoo.Gameplay.Liberty.Nodes
{
    [Category("Ggame")]
    public class CreateCityObject : CallableActionNodeBase
    {
        protected override void OnRegisterPorts(FlowNode node)
        {
            var o = node.AddFlowOutput("Out");
            var p1 = node.AddValueInput<string>("name");
            var p2 = node.AddValueInput<string>("aniName");
            var p3 = node.AddValueInput<Vector3>("position");
            var p4 = node.AddValueInput<Vector3>("rotation");
            var p5 = node.AddValueInput<int>("id");
            
            node.AddFlowInput("In", (Flow f) => { Invoke(p1.value, p2.value,p3.value,p4.value,p5.value); o.Call(f); });
        }

        private void Invoke(string name, string aniName, Vector3 position, Vector3 rotation,int id)
        {
            name = name.Trim();
            aniName = aniName.Trim();

            BlueprintUtils.CreateCityObject(name,aniName,position,rotation,id);
        }
    }
}
